<!--
 * @Author: your name
 * @Date: 2021-09-09 18:22:36
 * @LastEditTime: 2021-09-10 08:18:13
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: /notes/demo/必包.html
-->
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    // function useState(initialValue) {
    //     let state = initialValue;

    //     function setState(newState) {
    //         state = newState;
    //     }
    //     return [state, setState];
    // }

    // let [count,setCount] = useState(0)
    // setCount(count+1)
    // console.log(count)
    // setCount(count+1)
    // console.log(count)
    // setCount(count+1)
    // console.log(count)
    // setCount(count+1)
    // console.log(count)

    function add(num) {
        let count = num
        return function () {
            return num++
        }
    }
    const func = add(1)
    console.log(func(1))
    console.log(func(1))
    console.log(func(1))
    console.log(func(1))
    console.log(func(1))
</script>

</html>